<link rel="stylesheet" href="assets/store/css/goods.css?v=<?= $version ?>">
<link rel="stylesheet" href="assets/common/plugins/umeditor/themes/default/css/umeditor.css">
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" method="post">
                    <div class="widget-body">
                        <fieldset>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">基本信息</div>
                            </div>
                            <div class="am-form-group">
                                <input type="hidden" name="lesson[category_id_old]" value="<?= $model['category_id'] ?>">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">所属分类 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <select name="lesson[category_id]" required
                                            data-am-selected="{searchBox: 1, btnSize: 'sm',
                                             placeholder:'请选择课程分类', maxHeight: 400 ,btnWidth:'100%'}">
                                        <option value=""></option>
                                        <?php if (isset($catgory)): foreach ($catgory as $first): ?>
                                            <optgroup label="<?= $first['name'] ?>">
                                                <?php if (isset($first['child'])): foreach ($first['child'] as $two): ?>
                                                    <optgroup label="    　　<?= $two['name'] ?>">
                                                        <?php if (isset($two['child'])): foreach ($two['child'] as $three): ?>
                                                            <?php if ($model['category_id'] == $three['category_id']): ?>
                                                                <option value="<?= $three['category_id'] ?>" selected >
                                                                    　　　<?= $three['name'] ?></option>
                                                            <?php else:?>
                                                                <?php if (!$three['isused']): ?>
                                                                    <option value="<?= $three['category_id'] ?>" >
                                                                        　　　<?= $three['name'] ?></option>
                                                                <?php endif; ?>
                                                            <?php endif; ?>
                                                        <?php endforeach; endif; ?>
                                                    </optgroup>
                                                <?php endforeach; endif; ?>
                                            </optgroup>
                                        <?php endforeach; endif; ?>
                                    </select>
                                    <small class="am-margin-left-xs">
                                        <a href="<?= url('goods.category/add') ?>">去添加</a>
                                    </small>
                                </div>
                            </div>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">课程介绍</div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">课程大纲 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <!-- 加载编辑器的容器 -->
                                    <textarea id="outline" name="lesson[outline]" type="text/plain">
                                        <?= $model['outline'] ?>
                                    </textarea>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">重点知识 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <!-- 加载编辑器的容器 -->
                                    <textarea id="knowledge" name="lesson[knowledge]" type="text/plain">
                                         <?= $model['knowledge'] ?>
                                    </textarea>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">复习重点 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <!-- 加载编辑器的容器 -->
                                    <textarea id="reviewpoints" name="lesson[reviewpoints]" type="text/plain">
                                         <?= $model['reviewpoints'] ?>
                                    </textarea>
                                </div>
                            </div>
                            <!-- 表单提交按钮 -->
                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
                                    </button>
                                </div>
                            </div>

                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>


<script src="assets/common/js/vue.min.js"></script>
<script src="assets/common/js/ddsort.js"></script>
<script src="assets/common/plugins/umeditor/umeditor.config.js?v=<?= $version ?>"></script>
<script src="assets/common/plugins/umeditor/umeditor.min.js"></script>
<script src="assets/store/js/goods.spec.js?v=<?= $version ?>"></script>
<script>

    $(function () {

        // 富文本编辑器
        UM.getEditor('outline', {
            initialFrameWidth: 675 + 15,
            initialFrameHeight: 400
        });
        UM.getEditor('knowledge', {
            initialFrameWidth: 675 + 15,
            initialFrameHeight: 400
        });
        UM.getEditor('reviewpoints', {
            initialFrameWidth: 675 + 15,
            initialFrameHeight: 400
        });
        /**
         * 表单验证提交
         * @type {*}
         */
        $('#my-form').superForm();
    });
</script>
